using UnityEngine;
using System.Collections;
using System.Collections.Generic;

/// \class  gkDelayedEvent
/// \brief  Delayed event
public class gkDelayedEvent 
{	
	/// The time before event
	private float m_fTimeBeforeEvent;
	
	/// The event name
	private string m_strEventName;
	
	/// The optional event object
	private Object m_rEvent;
	
	/// \brief  Constructor
	public gkDelayedEvent(float a_fTimeBeforeEvent, string a_strEventName, Object a_rEvent = null)
	{
		m_strEventName = a_strEventName;
		m_fTimeBeforeEvent = a_fTimeBeforeEvent;
		m_rEvent = a_rEvent;
	}
	
	/// \brief  Get the event name  
	public string GetEventName()
	{
		return m_strEventName;
	}
	
	/// \brief  Grab the event  
	public Object GrabEvent()
	{
		return m_rEvent;
	}
	
	/// \brief  Count down the time before event
	/// \return  True when the count down is finish
	public bool CountDownTimeBeforeEvent(float a_fDeltaTime)
	{
		m_fTimeBeforeEvent -= a_fDeltaTime;
		if(m_fTimeBeforeEvent <= 0.0f)
		{
			return true;
		}
		
		return false;
	}
}
